#include <bits/stdc++.h>
using namespace std;


class Solution {
public:
    int FindGreatestSumOfSubArray(vector<int> array) {
        vector<int>dp(array.size());
        dp[0] = array[0];
        int _max = array[0];
        for(int i = 1; i < array.size(); i++){
            dp[i] = max(dp[i-1] + array[i], array[i]);
            _max = max(_max, dp[i]);
        }
        return _max;
    }
};